<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateGuanyuanSyncShopListTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('guanyuan_sync_shop_list', function (Blueprint $table) {
            $table->id();
            $table->string('businessGrade', 12)->default('')->comment('门店营业分级');
            $table->string('region', 24)->default('')->comment('区域');
            $table->string('operationManager', 24)->default('')->comment('运营负责人');
            $table->string('privateDomain', 36)->default('')->comment('私域');
            $table->string('takeawayStartTime', 20)->default('')->comment('外卖介入时间');
            $table->unsignedInteger('code')->default(0)->comment('铺位号');
            $table->string('name', 36)->default('')->comment('门店名称');
            $table->string('status', 12)->default('')->comment('状态');
            $table->string('businessType', 12)->default('')->comment('经营类型');
            $table->string('storeType', 12)->default('')->comment('铺位类型');
            $table->string('cashierSystem', 12)->default('')->comment('收银系统');
            $table->string('province', 24)->default('')->comment('门店所在省');
            $table->string('city', 24)->default('')->comment('门店所在市');
            $table->string('district', 24)->default('')->comment('区/县');
            $table->string('belongBranch', 24)->default('')->comment('所属分公司');
            $table->string('address', 120)->default('')->comment('店铺地址');
            $table->string('contractStartDate', 12)->default('')->comment('合同开始日期');
            $table->string('contractEndDate', 12)->default('')->comment('合同结束日期');
            $table->string('openBusinessDate', 12)->default('')->comment('开业日期');
            $table->string('closeDate', 12)->default('')->comment('闭店时间');
            $table->decimal('franchiseFee')->default(0)->comment('加盟费');
            $table->decimal('managementFee')->default(0)->comment('管理费');
            $table->decimal('transferFee')->default(0)->comment('技术转让费');
            $table->decimal('area')->default(0)->comment('面积');
            $table->decimal('rent')->default(0)->comment('房租');
            $table->decimal('artificial')->default(0)->comment('人工');
            $table->decimal('energy')->default(0)->comment('能源');
            $table->unsignedTinyInteger('employeesNum')->default(0)->comment('员工人数');
            $table->string('operationSupervision', 24)->default('')->comment('运营督导');
            $table->string('developmentManager', 24)->default('')->comment('开发经理');
            $table->string('siteLocationType', 24)->default('')->comment('选址分类');
            $table->decimal('inputPrice')->default(0)->comment('一次性投入-新');
            $table->string('phone', 15)->default('')->comment('电话');
            $table->string('degreeOfCooperation', 64)->default('')->comment('配合程度');
            $table->string('franchiseeRealName', 12)->default('')->comment('加盟商真名');
            $table->string('franchiseeName', 12)->default('')->comment('加盟商名称');
            $table->string('franchiseConsultant', 24)->default('')->comment('加盟顾问');
            $table->string('preparatoryConsultant', 24)->default('')->comment('筹备顾问');
            $table->string('preparatoryFinishDate', 24)->default('')->comment('筹备完成日期');
            $table->string('preparatoryStartDate', 24)->default('')->comment('筹备开始日期');
            $table->unsignedTinyInteger('preparatoryTimeConsumed')->default(0)->comment('筹备耗时(天)');
            $table->unsignedTinyInteger('openShopTimeConsumed')->default(0)->comment('开店耗时(天)');
            $table->decimal('lng', 12, 9)->default(0)->comment('门店经度');
            $table->decimal('lat', 12, 9)->default(0)->comment('门店纬度');
            $table->string('designConsultant', 24)->default('')->comment('设计顾问');
            $table->string('designStartDate', 12)->default('')->comment('设计开始日期');
            $table->string('designEndDate', 12)->default('')->comment('设计结束日期');
            $table->string('currentStatus', 12)->default('')->comment('当前状态');
            $table->string('currentNodeName', 12)->default('')->comment('当前节点名称');
            $table->string('estimatedOpeningTime', 12)->default('')->comment('预计开业时间');
            $table->string('relocationMark', 24)->default('')->comment('迁址标记');
            $table->string('keyCity', 12)->default('')->comment('重点城市');
            $table->string('subStatus', 12)->default('')->comment('子状态');
            $table->string('earliestRevenueDate', 12)->default('')->comment('最早有营收日期');
            $table->string('orderNo', 24)->default('')->comment('订单编号');
            $table->string('confirmSiteDate', 12)->default('')->comment('确址日期');
            $table->decimal('actualIncome', 9)->default(0)->comment('门店近30天实收');
            $table->string('shopGrade', 12)->default('')->comment('门店最近营业额评级');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->collation = 'utf8mb4_general_ci';

            $table->index('code', 'idx_code');
            $table->index('area', 'idx_area');
            $table->index('city', 'idx_city');

            $table->comment = '观远门店列表每日镜像';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('guanyuan_sync_shop_list');
    }
}
